package pl.ydp.components.mathcell.mathrecognizer.engine.database.modelsets.math_basic.characters
{
	import pl.ydp.components.mathcell.mathrecognizer.characters.Character;
	import pl.ydp.components.mathcell.mathrecognizer.geometry.classification.PrimitiveType;
	import pl.ydp.components.mathcell.mathrecognizer.model.PrimitivesRelation;
	import pl.ydp.components.mathcell.mathrecognizer.model.RelationDescription;
	import pl.ydp.components.mathcell.mathrecognizer.model.RelationDescriptorType;
	import pl.ydp.components.mathcell.mathrecognizer.model.ShapeModel;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.ConnectionsDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.CrossDescriptior;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.LocationDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.ObjectDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.SizeDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.presets.PrimitivePresets;
	
	public class MB_ch_7
	{
		
		public static const MODELS_COUNT:Number = 1;
		
		//---------------------------------------------------
		
		public static function getModels():Array{
			
			var sevenShapeModels:Array = new Array();
			
			sevenShapeModels.push(getModel0());
			sevenShapeModels.push(getModel1());	
			sevenShapeModels.push(getModel2());
			sevenShapeModels.push(getModel3());		
			sevenShapeModels.push(getModel4());		
			sevenShapeModels.push(getModel5());			
			
			return sevenShapeModels;
		}
		
		//---------------------------------------------------
		
		private static function getModel0():ShapeModel{
			var seven:ShapeModel;
			var name:String = "MB_7_SIMPLE";
			var seven_prim:Array = new Array();
			var seven_ref:Array = new Array();
			var seven_rel:Array = new Array();
			
			seven_prim.push(PrimitiveType.LINE0 | PrimitiveType.LINE3 | PrimitiveType.CURVE_SOUTH, PrimitiveType.LINE2 | PrimitiveType.LINE3);
			
			seven_ref.push(0,1,PrimitivePresets.RLT_FULL);
			
			seven_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.DEFAULT, ObjectDescriptor.HALF_TOP)));
			
			seven_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 10, ObjectDescriptor.END_EASTERN, ObjectDescriptor.END_NORTHERN)));
			
			seven_rel.push(new RelationDescription(0,2,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.WIDTH | SizeDescriptor.ABOUT_25, 7)));
			
			seven_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.HEIGHT | SizeDescriptor.ABOUT_25, 7)));
			
			seven = new ShapeModel(Character.SEVEN, seven_prim, seven_ref, seven_rel, new Array(), name, false);
			
			return seven;				
		}
		
		//---------------------------------------------------
		
		private static function getModel1():ShapeModel{
			var seven:ShapeModel;
			var name:String = "MB_7_MORE";
			var seven_prim:Array = new Array();
			var seven_ref:Array = new Array();
			var seven_rel:Array = new Array();
			
			seven_prim.push(PrimitiveType.LINE0 | PrimitiveType.LINE3  | PrimitiveType.CURVE_SOUTH, PrimitiveType.LINE2 | PrimitiveType.LINE3, PrimitiveType.LINE3 | PrimitiveType.LINE0 | PrimitiveType.LINE1);
			
			seven_ref.push(0,1,2,PrimitivePresets.RLT_FULL);
			
			seven_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.DEFAULT, ObjectDescriptor.HALF_TOP)));
			
			seven_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 10, ObjectDescriptor.END_EASTERN, ObjectDescriptor.END_NORTHERN)));
			
			seven_rel.push(new RelationDescription(0,3,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.WIDTH | SizeDescriptor.ABOUT_25, 3)));
			
			
			seven_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 7, ObjectDescriptor.HALF_TOP, ObjectDescriptor.DEFAULT)));
			
			seven_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.BELOW, 7, ObjectDescriptor.HALF_BOTTOM, ObjectDescriptor.DEFAULT)));
			
			seven_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.CROSS, CrossDescriptior.CROSSING, 10)));
			
			seven_rel.push(new RelationDescription(1,3,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.HEIGHT | SizeDescriptor.ABOUT_25, 3)));
			
			seven_rel.push(new RelationDescription(2,3,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.WIDTH | SizeDescriptor.SHORTER | SizeDescriptor.THREE_QUARTERS, 10)));
			
			seven = new ShapeModel(Character.SEVEN, seven_prim, seven_ref, seven_rel, new Array(), name, false);
			
			return seven;				
		}
		
		//---------------------------------------------------//---------------------------------------------------
		
		private static function getModel2():ShapeModel{
			var seven:ShapeModel;
			var name:String = "MB_7_SIMPLE_EXTRA";
			var seven_prim:Array = new Array();
			var seven_ref:Array = new Array();
			var seven_rel:Array = new Array();
			
			seven_prim.push(PrimitiveType.LINE0 | PrimitiveType.CURVE_SOUTH, PrimitiveType.LINE2 | PrimitiveType.LINE3, PrimitiveType.LINE2 | PrimitiveType.LINE3);
			
			seven_ref.push(0,1,2,PrimitivePresets.RLT_FULL);
			
			seven_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.DEFAULT, ObjectDescriptor.HALF_TOP)));
			
			seven_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 10, ObjectDescriptor.END_EASTERN, ObjectDescriptor.END_NORTHERN)));
						
			seven_rel.push(new RelationDescription(0,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.RIGHT, 10, ObjectDescriptor.END_WESTERN, ObjectDescriptor.COG)));
			
			
			seven_rel.push(new RelationDescription(2,3,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10)));
			
			seven_rel.push(new RelationDescription(2,3,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.IS_LOWER_THAN_HALF, 5)));
			
			
			seven_rel.push(new RelationDescription(1,3,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.HEIGHT | SizeDescriptor.ABOUT_25, 3)));
			
			seven = new ShapeModel(Character.SEVEN, seven_prim, seven_ref, seven_rel, new Array(), name, false);
			
			return seven;				
		}
		
		//---------------------------------------------------
		
		private static function getModel3():ShapeModel{
			var seven:ShapeModel;
			var name:String = "MB_7_MORE_EXTRA";
			var seven_prim:Array = new Array();
			var seven_ref:Array = new Array();
			var seven_rel:Array = new Array();
			
			seven_prim.push(PrimitiveType.LINE0 | PrimitiveType.CURVE_SOUTH, PrimitiveType.LINE2 | PrimitiveType.LINE3, PrimitiveType.LINE0 | PrimitiveType.LINE1, PrimitiveType.LINE2 | PrimitiveType.LINE3);
			
			seven_ref.push(0,1,2,3,PrimitivePresets.RLT_FULL);
			
			seven_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.DEFAULT, ObjectDescriptor.HALF_TOP)));
			
			seven_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 10, ObjectDescriptor.END_EASTERN, ObjectDescriptor.END_NORTHERN)));
						
			seven_rel.push(new RelationDescription(0,3,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.RIGHT, 10, ObjectDescriptor.END_WESTERN, ObjectDescriptor.COG)));
			
			
						
			seven_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 7, ObjectDescriptor.HALF_TOP, ObjectDescriptor.DEFAULT)));
			
			seven_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.BELOW, 7, ObjectDescriptor.HALF_BOTTOM, ObjectDescriptor.DEFAULT)));
			
			seven_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.CROSS, CrossDescriptior.CROSSING, 10)));
			
			seven_rel.push(new RelationDescription(1,4,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.HEIGHT | SizeDescriptor.ABOUT_25, 3)));
			
			
			seven_rel.push(new RelationDescription(3,4,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10)));
			
			seven_rel.push(new RelationDescription(3,4,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.IS_LOWER_THAN_HALF, 5)));
			
			
			seven = new ShapeModel(Character.SEVEN, seven_prim, seven_ref, seven_rel, new Array(), name, false);
			
			return seven;				
		}
		
		//---------------------------------------------------
		
		private static function getModel4():ShapeModel{
			var seven:ShapeModel;
			var name:String = "MB_7_ROUND_MORE";
			var seven_prim:Array = new Array();
			var seven_ref:Array = new Array();
			var seven_rel:Array = new Array();
			
			seven_prim.push(PrimitiveType.CURVE_NE, PrimitiveType.LINE0 | PrimitiveType.LINE1);
			
			seven_ref.push(0,1,PrimitivePresets.RLT_FULL);
						
			seven_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CROSS, CrossDescriptior.CROSSING, 10)));
			
			seven_rel.push(new RelationDescription(0,2,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.HEIGHT | SizeDescriptor.ABOUT_15, 10)));
			
			seven_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 7, ObjectDescriptor.DEFAULT, ObjectDescriptor.HALF_BOTTOM)));
			
			seven_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.BELOW, 7, ObjectDescriptor.DEFAULT, ObjectDescriptor.HALF_TOP)));
			
			seven = new ShapeModel(Character.SEVEN, seven_prim, seven_ref, seven_rel, new Array(), name, false);
			
			return seven;				
		}
		
		//---------------------------------------------------
		
		private static function getModel5():ShapeModel{
			var seven:ShapeModel;
			var name:String = "MB_7_BEND";
			var seven_prim:Array = new Array();
			var seven_ref:Array = new Array();
			var seven_rel:Array = new Array();
			
			seven_prim.push(PrimitiveType.LINE0, PrimitiveType.CURVE_67, PrimitiveType.LINE0 | PrimitiveType.LINE1);
			
			seven_ref.push(0,1,2,PrimitivePresets.RLT_FULL);
			
			seven_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.DEFAULT, ObjectDescriptor.HALF_TOP)));
			
			seven_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 5, ObjectDescriptor.END_EASTERN, ObjectDescriptor.END_NORTHERN)));
			
			seven_rel.push(new RelationDescription(0,3,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.WIDTH | SizeDescriptor.ABOUT_25, 3)));
			
			
			seven_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 7, ObjectDescriptor.HALF_TOP, ObjectDescriptor.DEFAULT)));
			
			seven_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.BELOW, 7, ObjectDescriptor.HALF_BOTTOM, ObjectDescriptor.DEFAULT)));
			
			seven_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.CROSS, CrossDescriptior.CROSSING, 10)));
			
			seven_rel.push(new RelationDescription(1,3,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.HEIGHT | SizeDescriptor.ABOUT_25, 3)));
			
			seven = new ShapeModel(Character.SEVEN, seven_prim, seven_ref, seven_rel, new Array(), name, false);
			
			return seven;				
		}
		
		//---------------------------------------------------

	}
}